package com.oreilly.ez.entity;


import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.ToString;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 开班信息
 */
@Data
@Entity
@Table(name = "course_term")
@ToString
public class CourseTerm  extends BaseEntity {


  // new field...
    @Column(name = "course_time")
    private String courseTime;


    //所属课程
    @ManyToOne
    @JoinColumn(name = "course_id")
    private Course course;

    @JsonFormat(pattern = "yyyy-MM-dd", timezone="GMT+8")
    @Column(name = "start_date")
    private Date startDate;

    private Integer totals;

    private String room;


//    @ManyToOne
//    @JoinColumn(name = "teach_id")
//    private Teacher teacher;
   @Column(name = "teach_ids")
   private String teachIds;

   @Column(name = "teach_names")
   private String teachNames;


    //费用价格
    private BigDecimal fee;



  public String getCourseName(){
    if(course == null){
      return "";
    }
    return course.getSname();
  }

}
